<!DOCTYPE html>
<html class="no-js" lang="zh_CN">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1">
    <title>${system_admin_title}</title>
    #required_css
</head>
<body>#loading

<div class="app $!layout">
    <!-- 头部菜单 -->#header
    <section class="layout">
        <!-- 菜单 -->#sidebar
        <!-- 内容主体 -->
        <section class="container">
            <section class="main-content">
                <!-- 主体操作栏 -->
                <header class="header navbar">
                    <!-- 左按钮区 -->
                    <div class="btn-group tool-button">
                        <a href="$!basePath/bi/flow/design" class="btn btn-primary navbar-btn" target="_blank"><i
                                class="ti-plus"></i> 创建新流程</a>
                    </div>
                    <!-- 右按钮区 -->
                    <div class="btn-group pull-right"></div>
                </header>
                <div class="content-wrap">
                    <div class="wrapper">
                        <form id="form" action="#action" method="post">
                            <div class="row clearfix">
                                <div class="col-md-12 column">
                                    <table class="table">
                                        <thead>
                                        <tr>
                                            <th class="col-md-4">流程名称</th>
                                            <th class="col-md-2">所属分类</th>
                                            <th class="col-md-2">最后修改时间</th>
                                            <th class="col-md-2">#springMessage('system.common.status')</th>
                                            <th>#springMessage('system.common.op')</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        #foreach($!obj in $!list)
                                        <tr>
                                            <td>$!obj.name</td>
                                            <td></td>
                                            <td>$!obj.createTime</td>
                                            <td>#if($!obj.deployId.length()>0)<span
                                                    class="label label-success">已部署</span>#else<span
                                                    class="label label-default">未部署</span>#end
                                            </td>
                                            <td>
                                                <div class="btn-group">
                                                    <button type="button" class="btn btn-default btn-xs dropdown-toggle"
                                                            data-toggle="dropdown">
                                                        <i class="ti-settings"></i>
                                                        <span class="ti-angle-down"></span>
                                                    </button>
                                                    <ul class="dropdown-menu" role="menu">
                                                        #if($!obj.deployId.length()>0)
                                                        <li><a href="javascript:;"
                                                               onclick="unDeploy('$!obj.id')">取消部署</a></li>
                                                        #else
                                                        <li><a href="javascript:;" onclick="deploy('$!obj.id')">部署</a>
                                                        </li>
                                                        #end
                                                        <li><a href="$!basePath/bi/flow/edit/$!obj.id">#springMessage('system.common.edit')</a>
                                                        </li>
                                                        <li><a href="javascript:;" onclick="del('$!obj.id')">#springMessage('system.common.delete')</a>
                                                        </li>
                                                    </ul>
                                                </div>
                                            </td>
                                        </tr>
                                        #end
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-md-12">#pager_ajax</div>
                            </div>
                        </form>
                    </div>
                    <a class="exit-offscreen"></a>
                </div>
            </section>
        </section>
    </section>
</div>
#required_js
<!-- 页面组件 -->

<!-- 本页面脚本 -->
<script src="$!basePath/framework/js/view/toast.js"></script>
<script type="text/javascript">
    function deploy(id) {
        jQuery.post("$!basePath/bi/flow/deploy", {id: id}, function (data) {
            if (data.success == true) {
                //Toast.success("部署成功！");
                window.location.reload();
            } else {
                Toast.error(data.error);
            }
        });
    }
    function unDeploy(id) {
        jQuery.post("$!basePath/bi/flow/undeploy", {id: id}, function (data) {
            if (data.success == true) {
                //Toast.success("取消部署成功！");
                window.location.reload();
            } else {
                Toast.error(data.error);
            }
        });
    }
</script>
#loading_close
</body>

</html>